<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta content="text/html; charset=UTF-8" http-equiv="content-type" />
<?php
//查找子分类名称和简介
foreach ($cats['list'] as $v) if ($v['id'] == $pid) {
    $subCat     = $v['name'];
    $catdesc    = $v['desc'];
}
?>
<title> <?php echo $cats['parent']['name'] ? $cats['parent']['name'].($subCat ? " - $subCat" : '') : '搜索结果'?> - <?=SITE_NAME?>:最具创意的礼品店 创意礼物 创意杂货 创意家居 创意玩具 </title>
<meta name="Keywords" content="<?php echo $cats['parent']['name'] ? $cats['parent']['name'].($subCat ? " - $subCat" : '') : '搜索结果'?>,LooPo,乐铺,创意礼品,创意礼物,创意生日礼物,创意杂货,创意家居,创意玩具,创意T恤" />
<meta name="Description" content="<?=SITE_NAME?>-最具创意的礼品店，主营创意礼物、创意生日礼物、创意杂货、创意家居、创意玩具、创意T恤等各种国内外创意品牌产品。正品保证，7天无条件退换保证。乐铺，用心经营，真诚对待每一位顾客。" />
<?php include VIEWS.'header.html'?>
</head>

<body>

<?php include VIEWS.'topbar.html'?>

<div id="content">

    <?php $left_scroll=true; include VIEWS.'leftnav.html'?>

    <div id="right">
    <?php include VIEWS.'sidesearch.html'?>

    <h1>
    <?php
    echo $cats['parent']['name'] ? $cats['parent']['name'] : ($pid ? '输错了吧 :P' : ($search ? '乐铺搜索：'.$search.' &nbsp; <a title="使用RSS订阅本页更新" tabindex="100" href="/itemslist?filter='.urlencode($search).'&xml=1"><img width="30" height="14" border="0" src="/images/rss.gif" alt="RSS Feed" /></a> <a title="使用RSS邮天下订阅本页更新" href="http://www.emailrss.cn/?rss='.$_servername.'/itemslist?filter='.urlencode(urlencode($search)).urlencode('&xml=1').'" target="_blank"><img width="42" height="13" border="0" src="/images/rssmail.gif" alt="RSS邮天下" /></a>' : '搜索结果'));
    if ($subCat) echo " <span style='font-size:0.7em'>&bull;</span> <span style='font-size:16px'>{$subCat}</span>";
    
    //没有分类简介就显示父分类简介
    if(!$catdesc) $catdesc = $cats['parent']['desc'];
    ?>
    </h1>

<?php if (count($list['list'])==0):?>

<div class="errbox roundNormal">&nbsp;&nbsp;&nbsp;没有找到您需要的物品，为何不看看我们的 <a tabindex="1" href="/whathot" class="white">热门物品</a> ?</div><br clear="all">

<?php else:?>

<?php include VIEWS.'shopcarinfo.html'?>

<?php
//分类说明
if($catdesc && $list['page']['p']==1):?>
<div id="catdesc"><?php echo $catdesc?><br /></div>
<?php endif?>

<form action="">
    <div style="float:left">
    <font class="px12" style="color:#666">&nbsp;排序方式</font>
    <select name="o" class="px12" style="color:#666" onchange="javascript:submit()">
    <option value="4"<?php if($_GET['o']==4) echo ' selected="selected"'?>>喜爱程度</option>
    <option value="1"<?php if($_GET['o']==1) echo ' selected="selected"'?>>物品名称</option>
    <option value="2"<?php if($_GET['o']==2) echo ' selected="selected"'?>>价格</option>
    <option value="3"<?php if(!$_GET['o'] || $_GET['o']==3) echo ' selected="selected"'?>>更新日期</option>
    </select>
    &nbsp;
    <font class="px12" style="color:#666">&nbsp;每页显示</font>
    <select name="pagesize" class="px12" style="color:#666" onchange="javascript:submit()">
    <option value="25">请选择</option>
    <option value="25"<?php if(!$pagesize || $pagesize==25) echo ' selected="selected"'?>>25条</option>
    <option value="50"<?php if($pagesize==50) echo ' selected="selected"'?>>50条</option>
    <option value="100"<?php if($pagesize==100) echo ' selected="selected"'?>>100条</option>
    </select>
    <input type="hidden" name="p" value="<?php echo (int)$_GET['p']?>" />
    <?php if($search):?><input type="hidden" name="filter" value="<?php echo $search?>" /><?php endif?>
    <?php if($pricefrom):?><input type="hidden" name="pf" value="<?php echo $pricefrom?>" /><?php endif?>
    <?php if($priceto):?><input type="hidden" name="pt" value="<?php echo $priceto?>" /><?php endif?>
    </div>
</form>

<br /><br clear="all" />

<div class="itemlist">
<?php
//每行显示的物品数
$cols = 5;
//不满一行的用空白填充
$_needfill = ($cols - count($list['list']) % $cols);
if ($_needfill != $cols) for ($_n=0; $_n<$_needfill; $_n++) $list['list'][] = null;
?>

<table cellpadding="0" cellspacing="0" align="center" id="itemlist_table" border="0">
    <?php
    foreach ($list['list'] as $v):
    do_action('view_itemslist_item', array('item'=>&$v));
    //$v['price1'] = preg_replace('/^(\d+)\.(\d+)$/', '$1.<font size="-2">$2</font>', $v['price1']);
    $v['price'] = ($v['stocknum'] > 0 ? "<font class=\"price_small\">". (intval($v['price2'])>intval($v['price1']) ? "特价 " : '') ."&yen; {$v['price1']}</font>" : "<a href=\"/alertme/{$v['id']}\" onclick=\"javascript:alertme({$v['id']});return false\"><div class='sprites btn_alertme_s'><span>到货通知我</span></div></a>");
    if($item_i%$cols==0):
    ?><tr><?php endif?>

    <td width="20%" align="center" height="240">
        <?php if($v['model']):?>

            <div class="items" id="item<?php echo $v['id']?>"><a href="/<?php echo $v['id']?>/<?php echo $pid?>" style="background:transparent"><img vspace="5" src="/images/items/thumb/120/<?php echo $v['model']?>.png" width="120" height="120" alt="<?php echo htmlspecialchars($v['name'])?>" class="<?php echo ($v['stocknum'] == 0 ? 'dark' : 'hand')?>" /></a></div><br clear="all" />
            <div class="items_name"><a class="px12" tabindex="2" href="/<?php echo $v['id']?>/<?php echo $pid?>" onmousedown="return cl(this,'<?php echo $v['id']?>','items:click','<?php echo $v['sig_click']?>')"><?php echo htmlspecialchars(trim($v['name']))?></a></div>
            <div class="items_price"><b><?php echo $v['price']?></b></div>
            <br />
            <?php if($v['stocknum'] > 0):?><script type="text/javascript">new Draggable('item<?php echo $v['id']?>',{revert:true,onDrag:function(element){__dg(element)},onEnd:function(element){__de(element)}})</script><?php endif?>
        <?php endif?>
    </td>
    <?php if($item_i%$cols!=($cols-1)):?><td bgcolor="#<?php echo $v['name'] ? 'F3F3F3' : 'FFFFFF' ?>"><img src="/images/blank.gif" width="1" height="1" alt="" /></td><?php endif?>

<?php $item_i++;?>
<?php if($item_i%$cols==0):?></tr><?php endif?>
<?php endforeach;?>
</table>
</div>

<?php include VIEWS.'pages.html'?>
<?php endif;?>

    </div>
</div>

<?php include VIEWS.'copyright.html'?>

</body>
</html>
